home *** CD-ROM | disk | FTP | other *** search
- /****************************************************************************
- *
- * $Source: /unixb/home/unixlib/source/unixlib37/src/unix/c/RCS/putenv,v $
- * $Date: 1996/05/06 09:01:35 $
- * $Revision: 1.2 $
- * $State: Rel $
- * $Author: unixlib $
- *
- * $Log: putenv,v $
- * Revision 1.2 1996/05/06 09:01:35 unixlib
- * Updates to sources made by Nick Burrett, Peter Burwood and Simon Callan.
- * Saved for 3.7a release.
- *
- * Revision 1.1 1996/04/19 21:35:27 simon
- * Initial revision
- *
- ***************************************************************************/
-
- static const char rcs_id[] = "$Id: putenv,v 1.2 1996/05/06 09:01:35 unixlib Rel $";
-
- #include <stdlib.h>
- #include <string.h>
-
- #include <sys/os.h>
- #include <sys/unix.h>
- #include <sys.swis.h>
-
- int
- putenv (register char *s)
-
- {
- register char *v;
- int r[10];
- _kernel_oserror *e;
-
- if (!(v = strchr (s, '=')))
- return (-1);
-
- __addenv (s, 0);
-
- *v++ = 0;
- r[0] = (int) s;
- r[1] = (int) v;
- r[2] = strlen (v);
- r[3] = 0;
- r[4] = 0;
- e = os_swi (OS_SetVarVal, r);
- *--v = '=';
- if (e)
- {
- __seterr (e);
- return (-1);
- }
- return (0);
- }
-